package com.HuangJiaQing.www.controller;

import com.HuangJiaQing.www.model.Marketers;
import com.HuangJiaQing.www.model.WareHouse;
import com.HuangJiaQing.www.service.AdminService;
import com.HuangJiaQing.www.service.WareHouseService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * @author HONOR
 * @date 2022/7/29 15:13
 */
@Controller
public class AdminController {
    @Autowired
    private AdminService adminService;
    @Autowired
    private WareHouseService wareHouseService;

    @RequestMapping(value = "/toAudit", method = RequestMethod.GET)
    public String toAudit(Model model) {
        List<WareHouse> wareHouses = wareHouseService.selectWareHouseNeedAudit();
        model.addAttribute("warehouses", wareHouses);
        return "audit";
    }

    @RequestMapping("/adminLogin")
    public String adminLogin(Model model){
        List<Marketers> marketers = adminService.adminLogin();
        model.addAttribute("marketers",marketers);
        return "admin";
    }

}
